<?php
require_once('pworks/mvc/IResult.iface.php');


/**
* [2011-12-08][Milo Liu] Add for standard JSON data format
*/
class JsonResult implements IResult {
	public function show(IAction &$action, ResultConfig $config) {

		$result = array();

		$result['head']['status'] = $action->getStatus();
		$result['head']['errors'] = $action->getErrors();
		
		$result['head']['warnings'] = $action->getWarnings();
		$result['head']['infos'] = $action->getInfos();
		$result['body'] = $action->getData();

		echo json_encode($result);
	}
}
